
###############################################################################
#  PROJECT_ALL_DIR        - store all directories under the project
#                           used by the find<package>.cmake modules
#  PROJECT_ALL_LIB_DIR    - store all directories under the project
#                           which stores the built libraries
#

# - Try to find OpenSG
# Once done this will define following variables
#  
#  OPENSG_FOUND        - system has OpenSG
#  OPENSG_INCLUDE_DIRS - the OpenSG include directory
#  OPENSG_LIBRARY_DIRS - the OpenSG library directory
#  OPENSG_LIBRARIES    - Link these to use OpenSG
#

SET( OPENSG_FOUND "YES" )
SET( OPENSG_INCLUDE_DIRS ${PROJECT_ALL_DIR} )
SET( OPENSG_LIBRARY_DIRS ${PROJECT_ALL_LIB_DIR} )
SET( OPENSG_LIBRARIES )

FIND_PATH( OPENSG_INCLUDE_DIRS OpenSG/OSGConfig.h
    /usr/local/include
)

#SET( OPTION_PATHS  /usr/local/lib/dbg/ /usr/local/lib/opt/ )
#FIND_LIBRARY( OPENSG_base_LIBRARY
    #NAMES OSGBase
    #PATHS ${OPTION_PATHS}

FIND_LIBRARY( OPENSG_base_LIBRARY
    NAMES OSGBase
    PATHS /usr/local/lib/dbg/
          /usr/local/lib/opt/
)
FIND_LIBRARY( OPENSG_system_LIBRARY
    NAMES OSGSystem
    PATHS /usr/local/lib/dbg/
          /usr/local/lib/opt/
)
FIND_LIBRARY( OPENSG_window_x_LIBRARY
    NAMES OSGWindowX
    PATHS /usr/local/lib/dbg/
          /usr/local/lib/opt/
)
FIND_LIBRARY( OPENSG_window_glut_LIBRARY
    NAMES OSGWindowGLUT
    PATHS /usr/local/lib/dbg/
          /usr/local/lib/opt/
)

MESSAGE( STATUS 
    "----verbose: OPENSG_LIBRARIES:
    ${OPENSG_LIBRARIES}" )

SET( OPENSG_LIBRARIES 
    ${OPENSG_base_LIBRARY}
    ${OPENSG_system_LIBRARY}
    ${OPENSG_window_x_LIBRARY}
    ${OPENSG_window_glut_LIBRARY}
)

ADD_DEFINITIONS( -DOSG_WITH_GLUT )

# verbose
IF( BUILD_VERBOSE )
    MESSAGE( STATUS 
        "----verbose: OPENSG_INCLUDE_DIRS: 
        ${OPENSG_INCLUDE_DIRS}" )
    MESSAGE( STATUS 
        "----verbose: OPENSG_LIBRARY_DIRS: 
        ${OPENSG_LIBRARY_DIRS}" )
    MESSAGE( STATUS 
        "----verbose: OPENSG_LIBRARIES:
        ${OPENSG_LIBRARIES}" )
ENDIF( BUILD_VERBOSE )

